use go list
to analyze stdlib imports
#12368
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
As described in #11910, the current version of the experimental Go plugin parses the directory structure of the Go distribution to determine the imports provided by the standard library.
go list
already provides this information in JSON form when asked. This was also how the v1 plugin obtained the same information.Solution
Use
go list
to obtain import paths for the standard library. This PR introduces the base classResolvedImportPaths
which will be inherited by all types that represent import path mappings. The first use of this base class is for theResolvedImportPathsForGoLangDistribution
dataclass which represents analysis of the Go standard library.Testing
Added integration test for the import analysis and the first-party build integration test continues to pass.
Closes #11910.
[ci skip-rust]